# 统一处理器编译配置
cmake_minimum_required(VERSION 3.10)
project(cbp2make_ai_unified)

# 设置C++标准
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 设置 wxWidgets 路径
set(wxWidgets_ROOT_DIR $ENV{WXWIN})
if(NOT wxWidgets_ROOT_DIR)
    set(wxWidgets_ROOT_DIR "D:/vc/wxWidgets-3.2.7")
endif()

# 查找 wxWidgets
find_package(wxWidgets REQUIRED COMPONENTS core base)
if(wxWidgets_FOUND)
    message(STATUS "Found wxWidgets: ${wxWidgets_VERSION}")
    message(STATUS "wxWidgets include: ${wxWidgets_INCLUDE_DIRS}")
    message(STATUS "wxWidgets libraries: ${wxWidgets_LIBRARIES}")
else()
    message(FATAL_ERROR "wxWidgets not found!")
endif()

include(${wxWidgets_USE_FILE})

# 源文件
set(SOURCES
    main_unified.cpp
    workspace_parser.cpp
)

# 可执行文件
add_executable(cbp2make_ai ${SOURCES})

# 链接 wxWidgets 库
target_link_libraries(cbp2make_ai ${wxWidgets_LIBRARIES})

# 编译选项
if(MSVC)
    target_compile_options(cbp2make_ai PRIVATE /W4)
else()
    target_compile_options(cbp2make_ai PRIVATE -Wall -Wextra -Wno-unused-parameter)
endif()

# 设置输出目录
set_target_properties(cbp2make_ai PROPERTIES
    RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
)

# 安装目标
install(TARGETS cbp2make_ai DESTINATION bin)
